package com.xxxx.abstracttest;

import com.xxxx.abstracttest.service.AbstractInterfaceService;
import com.xxxx.mysql.model.WormLink;
import com.xxxx.mysql.service.LinkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


//@Controller
public  class AbstractTestController {

    /**
     * Qualifier 如果有多个实现类  按照此注解可以确认使用具体的实现类   也可以使用@Primary注解在重复的实例类上，会优先使用此类
     */
    @Qualifier("abstractA")
    @Autowired
     AbstractMain abstractMain;


   // @Qualifier("AbstractInterface")
    @Autowired
     private AbstractInterfaceService abstractInterfaceService;

    @RequestMapping("/callAbstract")
    @ResponseBody
    public String callAbstract(){
       String callAbstract = abstractMain.a();
        return callAbstract;
    }


    @RequestMapping("callInterface")
    @ResponseBody
    public String callInterface(){
        String callInterface = abstractInterfaceService.methodA();
        return callInterface;
    }
}


